package org.kaer.election.bean;

import android.os.Parcel;
import android.os.Parcelable;

/*    "positionId":int,
    "positionName":string,
    "condition":string,
    "choseableCount":int,		
                                                                                  
    "requireCount":int*/
public class Positions implements Parcelable {
    public int positionId;
    public String positionName;
    public String condition;
    public int choseableCount; // 最多可投票数
    public int requireCount; // 最少投票数
    public int selectedcount; //
    public String restriction; // 性别不限的是1 只限女性的是2
    public boolean iSelected;

    protected Positions(Parcel in) {
        positionId = in.readInt();
        positionName = in.readString();
        condition = in.readString();
        choseableCount = in.readInt();
        requireCount = in.readInt();
        selectedcount = in.readInt();
        restriction = in.readString();
        iSelected = in.readByte() != 0;
    }

    public static final Creator<Positions> CREATOR = new Creator<Positions>() {
        @Override
        public Positions createFromParcel(Parcel in) {
            return new Positions(in);
        }

        @Override
        public Positions[] newArray(int size) {
            return new Positions[size];
        }
    };

    @Override
    public String toString() {
        return "Positions [positionId=" + positionId + ", positionName=" + positionName + ", condition=" + condition
                + ", choseableCount=" + choseableCount + ", requireCount=" + requireCount + ", selectedcount="
                + selectedcount + ", restriction=" + restriction + "]";
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(positionId);
        dest.writeString(positionName);
        dest.writeString(condition);
        dest.writeInt(choseableCount);
        dest.writeInt(requireCount);
        dest.writeInt(selectedcount);
        dest.writeString(restriction);
        dest.writeByte((byte) (iSelected ? 1 : 0));
    }

}
